package com.zhongyi.service.impl;

import com.zhongyi.dao.AccountDao;
import com.zhongyi.domian.Account;
import com.zhongyi.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("accountService")
public class AccountServiceImpl implements IAccountService {

    @Autowired
    private AccountDao accountDao;

    public void setAccountDao(AccountDao accountDao) {
        this.accountDao = accountDao;
    }

    public void save(Account account) {
        accountDao.save(account);
    }

    public void update(Account account) {
        accountDao.update(account);
    }

    public void delete(Integer accountId) {
        accountDao.delete(accountId);
    }

    public Account findById(Integer id) {
        Account account1 = accountDao.findById(id);
        return account1;
    }

    public List<Account> findAll() {
        List<Account> accounts = accountDao.findAll();
        return accounts;
    }
}
